package com.zzg.demo.laboratory.staticvariable;

import java.util.concurrent.atomic.AtomicInteger;

public class StaticVariableClass {
    private static final AtomicInteger staticNumber = new AtomicInteger(1);
    private final AtomicInteger normalNumber = new AtomicInteger(1);

    public int getNormalNumber() {
        return normalNumber.getAndIncrement();
    }

    public int getStaticNumber() {
        return staticNumber.getAndIncrement();
    }

    public static void main(String[] args) {
        StaticVariableClass staticVariableClass = new StaticVariableClass();
        System.out.println(String.format("staticVariableClass NormalNumber:%s-StaticNumber:%s", staticVariableClass.getNormalNumber(), staticVariableClass.getStaticNumber()));
        System.out.println(String.format("staticVariableClass NormalNumber:%s-StaticNumber:%s", staticVariableClass.getNormalNumber(), staticVariableClass.getStaticNumber()));
        
        StaticVariableClass staticVariableClass2 = new StaticVariableClass();
        System.out.println(String.format("staticVariableClass2 NormalNumber:%s-StaticNumber:%s", staticVariableClass2.getNormalNumber(), staticVariableClass2.getStaticNumber()));
        System.out.println(String.format("staticVariableClass2 NormalNumber:%s-StaticNumber:%s", staticVariableClass2.getNormalNumber(), staticVariableClass2.getStaticNumber()));

        System.out.println(String.format("staticVariableClass NormalNumber:%s-StaticNumber:%s", staticVariableClass.getNormalNumber(), staticVariableClass.getStaticNumber()));
        System.out.println(String.format("staticVariableClass NormalNumber:%s-StaticNumber:%s", staticVariableClass.getNormalNumber(), staticVariableClass.getStaticNumber()));
    }
}
